/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author ivana
 */
@Entity
@Table(name = "transportetransportista")
@NamedQueries({
    @NamedQuery(name = "Transportetransportista.findAll", query = "SELECT t FROM Transportetransportista t"),
    @NamedQuery(name = "Transportetransportista.findByIdtransportetransportista", query = "SELECT t FROM Transportetransportista t WHERE t.idtransportetransportista = :idtransportetransportista")})
public class Transportetransportista implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idtransportetransportista")
    private Integer idtransportetransportista;
    @JoinColumn(name = "idTransportista", referencedColumnName = "idTransportista")
    @ManyToOne(optional = false)
    private Transportista transportista;
    @JoinColumn(name = "idTransporte", referencedColumnName = "idTransporte")
    @ManyToOne(optional = false)
    private Transporte transporte;

    public Transportetransportista() {
    }

    public Transportetransportista(Integer idtransportetransportista) {
        this.idtransportetransportista = idtransportetransportista;
    }

    public Integer getIdtransportetransportista() {
        return idtransportetransportista;
    }

    public void setIdtransportetransportista(Integer idtransportetransportista) {
        this.idtransportetransportista = idtransportetransportista;
    }

    public Transportista getTransportista() {
        return transportista;
    }

    public void setTransportista(Transportista transportista) {
        this.transportista = transportista;
    }

    public Transporte getTransporte() {
        return transporte;
    }

    public void setTransporte(Transporte transporte) {
        this.transporte = transporte;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtransportetransportista != null ? idtransportetransportista.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Transportetransportista)) {
            return false;
        }
        Transportetransportista other = (Transportetransportista) object;
        if ((this.idtransportetransportista == null && other.idtransportetransportista != null) || (this.idtransportetransportista != null && !this.idtransportetransportista.equals(other.idtransportetransportista))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Transportetransportista[idtransportetransportista=" + idtransportetransportista + "]";
    }

}
